1. Field of the Invention
The present invention relates to variable-length decoding technology, and more particularly to a sync restoring method and apparatus capable of maintaining synchronization for processing a signal in a variable-length decoder, even when a transmission error is generated in variable-length-coded digital data.
2. Description of Related Art
A variable-length coding (VLC) method is representative of a lossless coding method, and is widely used in combination with a coding method which uses a discrete cosine transform method or a differential pulse code modulation method in connection with an image signal coding technology. Such a VLC method assigns a short codeword to a frequently occurring symbol while assigning a longer codeword to an infrequently occurring symbol, thereby lowering total data transmission rate. Such a method is generally used in an image coding method such as an MPEG (Moving Picture Experts Group) system using ISO/CCITT Standards, or a high-definition television (HDTV) system developed in the U.S.A. A general VLC and variable-length decoding (VLD) method is disclosed in the following papers 1) "An Entropy Coding System for Digital HDTV Application" by Shaw-Min Lei and. Ming-Ting Sun (IEEE Transactions on Circuit & Systems for Video Technology, vol. No. 1, March 1991), and 2) "VLSI Architecture & Implementation of a Circuits & Systems" by Ming-ting Sun (Singapore, pp 200-203, May, 1991).
A variable-length coder of an image signal generates a VLC codeword in correspondence to a run-level pair which is generated using a general zigzag scan. Here, the run-level pair is composed of a run-length representing the number of sequential "0s" and a level which is not zero, as is well known. The VLC codewords generated by the variable-length coder are multiplexed with various headers and other parity information to form a sequential bitstream. The sequential bitstream received at a decoder is segmented as a predetermined size, for example, 24 bits to be written in a first-in-first-out (FIFO) memory. The variable-length-decoder reads a predetermined number of bits of data from the FIFO memory to perform a variable-length-decoding, and determines whether the predetermined number of the following bits of data is read on the basis of the number of bits of which the variable-length-decoding has been completed. In more detail, the variable-length-decoder sequentially detects a run-length pair corresponding to the VLC codeword among the read bits, and outputs "0s" according to the run-length of the detected run-length pair, to then output a level. Also, the variable-length-decoder reads new data having a predetermined number of bits from the FIFO memory when the number of the variable-length-decoded bits becomes equal to a predetermined number of bits. In this case, the bitstream includes the VLC codewords having variable lengths, with the number of the variable-length-decoded bits being continuously varied. In other words, since each boundary between the VLC codewords cannot be predicted during a variable-length-decoding process, a length of the VLC codeword to be currently decoded cannot be exactly determined until the previous VLC codeword has been decoded. For this reason, the variable-length-decoder is able to precisely decode the following VLC codeword on the basis of the number of bits of the current decoded VLC codeword, only after the current VLC codeword is decoded. Therefore, when the bitstream includes a transmission error, the variable-length-decoder performs a decoding operation by using an incorrect VLC codeword with respect to the error-generated portion. Accordingly, an incorrect decoding operation is continuously performed after that. Such a misoperation can cause an abnormal operation when data is read from the FIFO memory, with a result that the variable-length-decoder does not accomplish synchronization for decoding input data.